const wxPaymentApi = require('../weixin/payment');

const orderNotifyUrl = '/payment/creditOrderNotify';

// 充值下单
async function makeMchBill (orderId, openid, price) {
    orderId = orderId.toString();
    let notifyUrl = wxPaymentApi.getPaymentNotifyHost() + orderNotifyUrl;
    console.log('余额充值下单：' + openid + ',' + notifyUrl);
    return wxPaymentApi.makeMehBill(orderId, orderId, price, openid, '余额充值下单', notifyUrl);
}

// 查询订单详情
async function orderHasPayed (orderId) {
    return wxPaymentApi.orderHasPayed(orderId);
}

module.exports = {
    makeMchBill,
    orderHasPayed
};
